﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理后台登录</title>

    <!--图标库 可无视-->
    <link rel='stylesheet' href='../css/font-awesome.min.css'>

    <!--核心样式-->
    <link rel="stylesheet" href="../css/admin/style.css">
    <style type="text/css">

    </style>
</head>
<body>

<div class="container" style="max-width: none">
    <div class="card"></div>
    <div class="card">
        <form>
            <div class="input-container" style="margin-left: 20%;margin-right: 20%">
                <input type="text" id="account" required="required"/>
                <label for="account">用户名</label>
                <div class="bar"></div>
            </div>
            <div class="input-container" style="margin-left: 20%;margin-right: 20%">
                <input type="password" id="password" name="newPsw" required="required"/>
                <label for="password">密码</label>
                <div class="bar"></div>
            </div>
            <div class="button-container">
                <button type="button" onclick="add()"><span>提交</span></button>
            </div>
        </form>
    </div>

</div>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script src="../js/plugins/layer/layer.min.js"></script>
<script>
    function add() {
        var data = {}
        data['account'] = $('#account').val()
        data['psw'] = $('#password').val()
        $.ajax({
            url: 'addAdmin',
            type: 'POST',
            data: data,
            dataType: 'json',
            success: function (res) {
                if (res.code != 200) {
                    layer.msg(res.error)
                } else {
                    layer.msg('修改成功')
                    location.reload();
                }
            },
        });
    }
</script>
</body>
</html>

